package org.sport.model.entityModel;

import javax.persistence.*;

/**
 * Created by Allen on 2017/9/29.
 */
@Entity
@Table(name = "discusstable", schema = "sportinfo", catalog = "")
public class DiscusstableEntity {
    private int id;
    private String content;
    private Integer followId;
    private ActivitytableEntity activitytableByActivityId;
    private UsertableEntity usertableByUserId;

    @Id
    @Column(name = "id", nullable = false)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "content", nullable = true, length = 45)
    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Basic
    @Column(name = "followId", nullable = true)
    public Integer getFollowId() {
        return followId;
    }

    public void setFollowId(Integer followId) {
        this.followId = followId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        DiscusstableEntity that = (DiscusstableEntity) o;

        if (id != that.id) return false;
        if (content != null ? !content.equals(that.content) : that.content != null) return false;
        if (followId != null ? !followId.equals(that.followId) : that.followId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (content != null ? content.hashCode() : 0);
        result = 31 * result + (followId != null ? followId.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "activityId", referencedColumnName = "_id")
    public ActivitytableEntity getActivitytableByActivityId() {
        return activitytableByActivityId;
    }

    public void setActivitytableByActivityId(ActivitytableEntity activitytableByActivityId) {
        this.activitytableByActivityId = activitytableByActivityId;
    }

    @ManyToOne
    @JoinColumn(name = "userId", referencedColumnName = "_id")
    public UsertableEntity getUsertableByUserId() {
        return usertableByUserId;
    }

    public void setUsertableByUserId(UsertableEntity usertableByUserId) {
        this.usertableByUserId = usertableByUserId;
    }
}
